/**
 * @title HHAddUserTypeForm.java 
 * @description 	添加用户类型表单验证类
 * @create 			2012-8-14 上午10:54:14 By xjiujiu
 * @package 		apps.admin.form
 * @copyright 		Copyright (c) 2011-2012 http://xyrj.hhtc.edu.cn.com. All right reserved
 * @version         $Id$
 * XYRJ-Java-Project
 */

package apps.admin.form;

import com.xyrj.core.HHObject;
import com.xyrj.core.HHPojo;
import com.xyrj.core.IHHForm;
import com.xyrj.exception.HHValidateException;
import com.xyrj.mvc.HHView;
import com.xyrj.utils.HHVerify;

/** 
 * 添加用户类型表单验证类
 * 
 * @description
 * 
 * @classname 	HHAddUserTypeForm 
 * @author 		xjiujiu<xjiujiu@foxmail.com>
 * @date 		2012-8-14 上午10:54:14 
 * @version 	1.0
 */
/**
 * 添加用户类型表单验证类
 *  
 * @ClassName: HHAddUserTypeForm 
 * @Description:
 * @author maoyun0903(maoyun19900818@163.com);
 * @date 2012-10-8 下午8:51:31 
 * @version V1.0
 */
public class HHAddUsertypeForm extends HHObject implements IHHForm
{

	/* (非 Javadoc) 
	 * <p>验证POJO对象的合法性</p>
	 * 
	 * <p>description: </p> 
	 *
	 * @title validate 
	 * @param pojo
	 * @throws HHValidateException 
	 * @see com.xyrj.core.IHHForm#validate(com.xyrj.core.HHPojo) 
	 */
	@Override
	public void validate(HHPojo pojo) throws HHValidateException
	{
		if(true == HHVerify.isEmpty(pojo.getField("usertype_name"))) {
			throw new HHValidateException("类型名没有填写！");
		}
		if(false == HHVerify.checkStrLen((String)pojo.getField("usertype_name"), 2, 20)) {
			throw new HHValidateException("类型名长度不符！请参见说明信息～");
		}
		if(true == HHVerify.isEmpty(pojo.getField("top_flag"))) {
			throw new HHValidateException("是否置顶没有选择！");
		}
		if(true == HHVerify.isEmpty(pojo.getField("parent_id"))) {
			throw new HHValidateException("用户类型没有选择！");
		}
		if(true == HHVerify.isEmpty(pojo.getField("pass_flag"))) {
			throw new HHValidateException("是否审核通过没有选择！");
		}
	}

	/* (非 Javadoc) 
	 * <p>{point}</p>
	 * 
	 * <p>description: </p> 
	 *
	 * @title validate 
	 * @param view
	 * @throws HHValidateException 
	 * @see com.xyrj.core.IHHForm#validate(com.xyrj.mvc.HHView) 
	 */
	@Override
	public void validate(HHView view) throws HHValidateException
	{

	}

}
